package orderProcessingProcess.server;

import javax.jws.WebService;
import orderProcessingProcess.exceptions.faults.UnknownCustomerFault;
import orderProcessingProcess.model.Customer;
import orderProcessingProcess.util.AIC_log;

/**
 *
 * @author dreni
 */

@WebService(endpointInterface = "orderProcessingProcess.server.BankingService", serviceName = "BankingService", targetNamespace = "http://infosys.tuwien.ac.at/ait09/ass1/dto/bankingservice", portName = "bankingservicePT")
public class BankingServiceImpl implements BankingService
{

	private String type = "BankingService";
	
    public void chargeCreditCard(Customer customer, Double amount) throws UnknownCustomerFault 
    {
    	
    	//check the customer arg
        if(customer == null){
        	AIC_log.printerr(type, "Unknown Customer!");
            throw new UnknownCustomerFault("Customer argument is null.");
        }
        AIC_log.print(type, "Charging Creditcard for Customer: "+ customer.getName());
        AIC_log.print(type, "Amount to be charged: "+amount +" EURO");
    }

    public void doBankTransfer(Customer customer, Double amount) throws UnknownCustomerFault  
    {

    	//check the customer arg
        if(customer == null){
        	AIC_log.printerr(type, "Unknown Customer!");
        	throw new UnknownCustomerFault("Customer argument is null.");
        }
        
        AIC_log.print(type, "Bank transfer for Customer: "+ customer.getName());
        AIC_log.print(type, "Amount to be charged: "+amount +" EURO");

    } 
}
